package club.itstudio.itouc.core.util

import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import org.jsoup.safety.Whitelist

object Security {


    private val whiteList = Whitelist.basicWithImages().also {
        it.addAttributes(":all", "style")
    }
    private val outputSettings = Document.OutputSettings().prettyPrint(false)

    /**
     * xss 非法标签过滤
     */
    fun clean(data: String): String {
        return Jsoup.clean(data, "", whiteList, outputSettings)
    }

}
